<div class="wide form">

<?php $form=$this->beginWidget('CActiveForm', array(
    'id'=>'milestone-form',
    'focus'=>array($model,'name'),
    'enableAjaxValidation'=>false,
)); ?>

<p class="note"><?php echo Yii::t('site','Fields with {marker} are required.',array('{marker}'=>'<span class="required">*</span>')); ?></p>

    <?php echo $form->errorSummary($model); ?>

    <?php if(Yii::app()->getRequest()->getParam('Milestone_page')) echo CHtml::hiddenField('Milestone_page',Yii::app()->getRequest()->getParam('Milestone_page')); ?>

    <?php if($model->isNewRecord) : ?>
    <div class="row">
        <?php echo $form->labelEx($model,'projectId'); ?>
        <?php echo $form->dropDownList($model,'projectId',Project::model()->selectOptions,array('empty'=>Yii::t('site','(Select)'))); ?>
        <?php echo $form->error($model,'projectId'); ?>
    </div>
    <?php endif; ?>


    <div class="row">
        <?php echo $form->labelEx($model,'name'); ?>
        <?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>244)); ?>
        <?php echo $form->error($model,'name'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'description'); ?>
        <?php echo $form->textArea($model,'description',array('rows'=>6, 'cols'=>50)); ?>
        <?php echo $form->error($model,'description'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'dueDate'); ?>
        <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                'model'=>$model,
                'name'=>'Milestone[dueDate]',
                'value'=>Yii::app()->lc->toLocal($model->dueDate, 'date', 'medium'),                
                'language'=>Yii::app()->lc->getSelectedLanguageCalendar(),
                'options' => array('dateFormat'=>Yii::app()->locale->getDateFormat('calendar_small'),'changeMonth'=>true,'changeYear'=>true,'showButtonPanel'=>true),
                'htmlOptions' => array(/*'readonly'=>"readonly",*/'size'=>10,'maxlength'=>10,'class'=>'centered')
            )); ?>
        <?php echo $form->error($model,'dueDate'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'isReleased'); ?>
        <?php echo $form->checkBox($model,'isReleased'); ?>
        <?php echo $form->error($model,'isReleased'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'isDepreciated'); ?>
        <?php echo $form->checkBox($model,'isDepreciated'); ?>
        <?php echo $form->error($model,'isDepreciated'); ?>
    </div>

    <div class="row buttons">
        <?php $this->widget( 'application.extensions.button.DDButton',
			array(
				'title'=>$model->isNewRecord?Yii::t('site','Create'):Yii::t('site','Save'),
				'linkTitle'=>$model->isNewRecord?Yii::t('site','Create this record'):Yii::t('site','Save this record'),
				'formID' => 'milestone-form',
				'buttonType' => 'save'
		)); ?>
        <?php $this->widget( 'application.extensions.button.DDButton',
			array(
				'title'=>Yii::t('site','Reset'),
				'linkTitle'=>Yii::t('site','Reset the form data'),
				'formID' => 'milestone-form',
				'buttonType' => 'reset',
				'confirm' => Yii::t('site','Really reset this form?')
		)); ?>
        <?php $this->widget( 'application.extensions.button.DDButton',
			array(
				'title'=>Yii::t('site','Cancel'),
				'linkTitle'=>Yii::t('site','Cancel editing, back to list'),
				'formID' => 'milestone-form',
				'buttonType' => 'cancel',
				'confirm' => Yii::t('site','Really cancel editing this item?'),
				'url' => array('milestone/admin','Milestone_page'=>$page)
		)); ?>
    </div>

<?php $this->endWidget(); ?>

</div><!-- form -->
